<?php include  APP_PATH.'../template/public/header.php'?>
<aside class="main-sidebar">
    <section class="sidebar">
        <?php include APP_PATH.'../template/public/navigation.php'?>
    </section>
</aside>
<div class="content-wrapper">
    <section class="content-header">
        <h1>
            {$title}
            <a href="{:url('add_adv_plan')}" class="btn  btn-primary"><i class="fa fa-fw fa-plus"></i>新建广告计划</a>
        </h1>

        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> {$title}</a></li>
        </ol>
    </section>
    <section class="content">

        <div class="box">

            <div class="box-body">
                <div class="input-daterange input-group">
                    <div class="form-group" style="width: 200px;float: left;margin-left: 10px">
                        <select id="" name="attr_adv_user_id" class="select2"  style="width: 100%;">
                            <option value="">选择广告主</option>
                            {foreach $advertisers as $g}
                            <option value="{$g.user_id}">{$g.advertisers_name}</option>
                            {/foreach}
                        </select>
                    </div>
                    <form style="margin-left: 10px;float: left"class="layui-form" action="">
                            <input id="test" v="0" type="checkbox" name="close" lay-skin="switch" lay-filter="switchTest" lay-text="是|否"><label >是否显示数据</label>&nbsp;
                    </form>
                    <div class="form-group" style="width: 150px;float: left;margin-left: 10px">
                        <select id="" name="" class="select2"  style="width: 100%;">
                            <option value="">广告组状态</option>
                        </select>
                    </div>

                </div>
                <table id='table'
                       data-url="{:url('adv_group_list')}"
                       data-toggle="table"
                       data-show-refresh="true"
                       data-show-toggle="true"
                       data-show-columns="true"
                       data-search="true"
                       data-pagination="true"
                       data-query-params="queryParams"
                       data-advanced-search="true"
                       data-side-pagination="server"
                       data-select-item-name="worker_picker"
                       data-show-export="true"
                       data-click-to-select="true"
                       data-toolbar="#toolbar"
                       data-sort-name="name"
                       data-sort-order="desc">
                    <div class="bars pull-left">
                        <div id="toolbar">

                        </div>
                    </div>
                    <thead>
                    <tr>
                        <th data-field="group_name"  data-align="left" data-sortable="true" >广告组</th>
                        <th data-field="attr_adv_name"   data-align="left">广告主</th>
                        <th data-field="show_num"  data-align="left">展现</th>
                        <th data-field="click_num"  data-align="center">点击</th>
                        <th data-field="click_rate"   data-align="left">点击率</th>
                        <th data-field="CPC"   data-align="left">cpc</th>
                        <th data-field="CPM"   data-align="left">cpm</th>
                        <th data-field="sum_amount"   data-align="left">消耗（元）</th>
                        <th data-field="amount"   data-align="left">预算（元）</th>
                        <th data-field="operation"   data-align="left">操作</th>
                    </tr>

                    </thead>
                    <tbody>

                    </tbody>
                </table>
            </div>
        </div>
    </section>
</div>
<?php include APP_PATH.'../template/public/footer.php'; ?>
<script>
    layui.use(['form', 'layedit', 'laydate'], function() {
        $('.select2').select2();
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;
        form.on('switch(switchTest)', function(data){
                var state=(this.checked ? '1' : '0');
                $("#test").attr('v',state);
                $('#table').bootstrapTable("refresh");
        });
    });
    function queryParams(params) {
        return {
            limit: params.limit,
            offset: params.offset,
            search:$('.search input[type="text"]').val(),
            name: params.sort,
            order: params.order,
            state:$("#test").attr('v'),
            attr_adv_user_id:$('select[name="attr_adv_user_id"]').val(),
        };
    }
    $('select[name="attr_adv_user_id"]').change(function () {
        $('#table').bootstrapTable("refresh");
    });
</script>
</html>